package v1

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/os/gtime"
	"ruoyi-vue-pro-go/api/common"
	"ruoyi-vue-pro-go/internal/model/entity"
)

type GetOneReq struct {
	g.Meta `path:"/admin-api/system/tenant/get" method:"get" tags:"Tenant" permission:"system:tenant:query" summary:"Get tenant by id"`
	Id     uint `v:"required" dc:"tenant id"`
}
type GetOneRes struct {
	*entity.SystemTenant `dc:"tenant"`
}

type GetByWebsiteReq struct {
	g.Meta  `path:"/admin-api/system/tenant/get-by-website" method:"get" tags:"Tenant" noAuth:"true" role:"super_admin" permission:"system:tenant:query" summary:"Get tenant by website"`
	Website string `v:"required" dc:"tenant website"`
}
type GetByWebsiteRes struct {
	*entity.SystemTenant `dc:"tenant"`
}

type GetIdByNameReq struct {
	g.Meta `path:"/admin-api/system/tenant/get-id-by-name" method:"get" noAuth:"true" role:"super_admin" tags:"Tenant" permission:"system:tenant:query" summary:"Get tenant id by name"`
	Name   string `v:"required" dc:"tenant name"`
}

type GetIdByNameRes struct {
	Id uint `json:"id" dc:"tenant id"`
}

type GetListReq struct {
	g.Meta `path:"/admin-api/system/tenant/simple-list" method:"get" noAuth:"true" role:"super_admin" tags:"Tenant List" permission:"system:tenant:query" summary:"Get tenants"`
}
type GetListRes struct {
	List []*entity.SystemTenant `json:"list" dc:"tenant list"`
}

type GetPageReq struct {
	g.Meta `path:"/admin-api/system/tenant/page" method:"get" tags:"Tenant Page" permission:"system:tenant:query" summary:"Get tenants pages"`
	*common.CommonPageReq
	Name          string   `dc:"tenant name"`
	ContactName   string   `dc:"contact name"`
	ContactMobile string   `dc:"contact mobile"`
	Status        int      `dc:"status"`
	CreateTime    []string `dc:"create time"`
}
type GetPageRes struct {
	List []*entity.SystemTenant `json:"list" dc:"tenant pages"`
	*common.CommonPageRes
}

type UpdateReq struct {
	g.Meta        `path:"/admin-api/system/tenant/{id}" method:"put" tags:"Tenant" permission:"system:tenant:update" summary:"Update tenant"`
	Id            int64       `v:"required" dc:"tenant id"`
	Name          string      `v:"required" dc:"tenant name"`
	ContactName   string      `v:"required" dc:"联系人"`
	ContactMobile string      `v:"phone" dc:"联系手机"`
	Status        int         `v:"required|in:0,1" dc:"租户状态（0正常 1停用）"`
	Website       string      `v:"required" dc:"绑定域名"`
	PackageId     int64       `v:"required" dc:"租户套餐编号"`
	ExpireTime    *gtime.Time `v:"required" dc:"过期时间"`
	AccountCount  int         `v:"required" dc:"账号数量"`
}
type UpdateRes struct{}

type CreateReq struct {
	g.Meta        `path:"/admin-api/system/tenant/create" method:"post" tags:"Tenant" permission:"system:tenant:create" summary:"Create tenant"`
	Name          string      `v:"required" dc:"tenant name"`
	ContactName   string      `v:"required" dc:"联系人"`
	ContactMobile string      `v:"phone" dc:"联系手机"`
	Status        int         `v:"required|in:0,1" dc:"租户状态（0正常 1停用）"`
	Website       string      `v:"required" dc:"绑定域名"`
	PackageId     int64       `v:"required" dc:"租户套餐编号"`
	ExpireTime    *gtime.Time `v:"required" dc:"过期时间"`
	AccountCount  int         `v:"required" dc:"账号数量"`
}
type CreateRes struct{}

type DeleteReq struct {
	g.Meta `path:"/admin-api/system/tenant/delete" method:"delete" tags:"Tenant" permission:"system:tenant:delete" summary:"Delete tenant"`
	Id     int64 `v:"required"`
}
type DeleteRes struct{}

type DeleteListReq struct {
	g.Meta `path:"/admin-api/system/tenant/delete-list" method:"delete" tags:"Tenant" permission:"system:tenant:delete" summary:"Delete tenant list"`
	Ids    string `v:"required"`
}
type DeleteListRes struct{}

type ExportExcelReq struct {
	g.Meta `path:"/admin-api/system/tenant/export-excel" method:"get" tags:"Tenant" permission:"system:tenant:export" summary:"Export tenant excel"`
}
type ExportExcelRes struct {
	g.Meta `mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" type:"string" example:"<file content>"`
}
